package com.service;

import java.util.List;

import com.dao.CommentDao;
import com.dao.DocumentDao;
import com.entity.Comment;
import com.entity.Document;
import com.util.PageHelp;

public class DocumentService {
	
	private DocumentDao dd=new DocumentDao();
	private CommentDao cd=new CommentDao();
	
	public PageHelp<Document> findDocByPage(int pageNum) {
		PageHelp<Document> page=new PageHelp<Document>(10,dd.getCount(),pageNum);
		return dd.findByPage(page);
	}
	public void saveDoc(Document doc) {
		dd.saveDoc(doc);
	}
	public void del(String id) throws InterruptedException {
		cd.delByDocumentId(id);
		Thread.sleep(50);
		dd.delDoc(id);
	}
	public void eidtedSave(Document doc) {
		dd.update(doc);
		
	}
	public void saveSayFromDocToComment(Comment c) {
		cd.saveSayFromDoc(c);
	}
	public Document findById(String id) {
		// TODO Auto-generated method stub
		return dd.findById(id);
	}
	public List<Comment> findCommentByDocumentId(String id) {
		// TODO Auto-generated method stub
		return cd.findByDocumentId(id);
	}
	public void dellComment(String id) {
		// TODO Auto-generated method stub
		cd.delByCommentId(id);
	}
	
	
}
